package webmarket.controller.transferobjects;

import java.util.Arrays;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import webmarket.model.ReadLog;

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class LogTOFull extends LogTO {
	private static final long serialVersionUID = -899903603176883613L;
	private String exception;
	private String stackTrace;
	private String level;

	public LogTOFull() {
		super();
	}

	public LogTOFull(ReadLog log) {
		super(log);
		if (log.getThrown() != null) {
			this.exception = log.getThrown().toString();
			stackTrace = "";
			for (StackTraceElement ste : log.getThrown().getStackTrace()) {
				stackTrace += ste.toString() + "/r/n";
			}
		}
		this.level = log.getLevel();
	}

	/**
	 * @return the exception
	 */
	public String getException() {
		return exception;
	}

	/**
	 * @param exception
	 *            the exception to set
	 */
	public void setException(String exception) {
		this.exception = exception;
	}

	/**
	 * @return the stackTrace
	 */
	public String getStackTrace() {
		return stackTrace;
	}

	/**
	 * @param stackTrace
	 *            the stackTrace to set
	 */
	public void setStackTrace(String stackTrace) {
		this.stackTrace = stackTrace;
	}

	/**
	 * @return the level
	 */
	public String getLevel() {
		return level;
	}

	/**
	 * @param level
	 *            the level to set
	 */
	public void setLevel(String level) {
		this.level = level;
	}
}
